package com.yangyu.controller;

import com.yangyu.message.BaseRsp;
import com.yangyu.pojo.Comment;
import com.yangyu.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 一碗鱼汤面
 * @version V1.0
 * @Package com.yangyu.controller
 * @date 2020/12/20 21:43
 */
@Api(tags = "评论模块")
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @ApiOperation("添加评论")
    @PostMapping("/addComment")
    public BaseRsp addComment(@RequestBody Comment comment) {
        return commentService.addComment(comment);
    }

    @ApiOperation("查询评论")
    @GetMapping("/getCommentByBlogId/{blogId}")
    public BaseRsp getCommentByBlogId(@PathVariable long blogId) {
        return commentService.getCommentByBlogId(blogId);
    }
}
